﻿using System;
using Rhino.Mocks;

namespace CleanTest
{
    internal static class Expectation<TDependency> where TDependency : class
    {
        internal static void RunNeverExpectation(TDependency mock, Action<TDependency> expectedAction, Action runTest)
        {
            mock.Expect(expectedAction).Repeat.Never();
            runTest();
            mock.VerifyAllExpectations();
        }
        internal static void RunExpectation(TDependency mock, Action<TDependency> expectedAction, Action runTest)
        {
            mock.Expect(expectedAction);
            runTest();
            mock.VerifyAllExpectations();
        }
        internal static void RunExpectation<TResult>(TDependency mock, Function<TDependency, TResult> expectedFunction, TResult output, Action runTest)
        {
            mock.Expect(expectedFunction).Return(output);
            runTest();
            mock.VerifyAllExpectations();
        }
    }
}
